using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Elo.Exemplo.EFCodeFirst.Domain.Entities;

namespace Elo.Exemplo.EFCodeFirst.Domain.Mapping
{
	public class Current_Product_ListMap : EntityTypeConfiguration<Current_Product_List>
	{
		public Current_Product_ListMap()
		{
			// Primary Key
			this.HasKey(t => new { t.ProductID, t.ProductName });

			// Properties
			this.Property(t => t.ProductID)
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
				
			this.Property(t => t.ProductName)
				.IsRequired()
				.HasMaxLength(40);
				
			// Table & Column Mappings
			this.ToTable("Current Product List");
			this.Property(t => t.ProductID).HasColumnName("ProductID");
			this.Property(t => t.ProductName).HasColumnName("ProductName");
		}
	}
}

